package org.springframework.core;

import java.net.URL;

public class DefaultResourceLoader implements ResourceLoader {

    @Override
    public Resource getResource(String location) {
        if (location.startsWith(CLASSPATH_PREFIX)) {
            return new ClasspathResource(location.substring(CLASSPATH_PREFIX.length()));
        }
        Resource resource;
        try {
            resource = new UrlResource(new URL(location));
        } catch (Exception e) {
            resource =  new FileSystemResource(location);
        }
        return resource;
    }
}
